<?php
namespace app\myr\controller;
use think\admin\Controller;
use think\admin\helper\QueryHelper;

/**
 * 抽奖记录管理
 * Class LotteryRecrod
 * @package app\wechat\controller
 * @author guiqing <guiqing@qq.com>
 * @date 2021/08/04 14:43
 */
class LotteryRecrod extends Controller
{
    public $table = 'Winrecord';
    public $conn="vip_wissun_com";
    /**
     * 显示会员签到列表
     */
    public function index()
    {
        $this->title = '抽奖记录管理';
        list($get, $db) = array($this->request->get(), Db::connect($this->conn)->name($this->table));
        foreach (array('user_id','goods_name','goods_type') as $key) {
            (isset($get[$key]) && $get[$key] !== '') && $db->whereLike($key, "%{$get[$key]}%");
        }
        if (isset($get['add_date']) && $get['add_date'] !== '') {
            list($start, $end) = explode(' - ', $get['add_date']);
            $start=strtotime("{$start} 00:00:00");
            $end=strtotime("{$end} 23:59:59");
            $db->whereBetween('add_date',array($start, $end));
        }

        $typelist=config("integral_goods_type");
        $this->assign("typelist",$typelist);
        return parent::_list($db->where(array("is_delete"=>0))->order('id desc'));
    }
}